#@layout() #define main()
<div class="xp-layout">
	<div id="log_form" class="layui-form">
		<div class="layui-form-pane">
			<div class="layui-inline xp-input-container">
				<label class="layui-form-label">开始日期</label>
				<div class="layui-input-inline">
					<input type="text" id="beginTime" name="beginTime" lay-verify="" autocomplete="off" placeholder="请输入开始日期" class="layui-input">
				</div>
			</div>
			<div class="layui-inline xp-input-container">
				<label class="layui-form-label">终止日期</label>
				<div class="layui-input-inline">
					<input type="text" id="endTime" name="endTime" lay-verify="" autocomplete="off" placeholder="请输入终止日期" class="layui-input">
				</div>
			</div>
			<div class="layui-inline xp-input-container">
				<label class="layui-form-label">类型</label>
				<div class="layui-input-inline xp-select-container">
					<select id="type1" name="type1" lay-filter="changeType">
						<option value=' '>全部</option>
						<option value='2'>登录管理</option>
						<option value='3'>用户管理</option>
						<option value='4'>角色管理</option>
						<option value='5'>部门管理</option>
						<option value='8'>报警系统通知</option>
						<option value='9'>考车维护</option>
						<option value='10'>视频参数维护</option>
						<option value='11'>场地监控维护</option>
						<option value='12'>坐标维护</option>
					</select>
				</div>
			</div>
		</div>
		<div class="layui-form-pane">
			<div class="layui-inline xp-input-container">
				<label class="layui-form-label">方法名称</label>
				<div class="layui-input-inline">
					<input id="name" type="text" name="name" lay-verify="" autocomplete="off" placeholder="请输入接口名称" class="layui-input">
				</div>
			</div>
			<div class="layui-inline xp-input-container">
				<label class="layui-form-label">用户名</label>
				<div class="layui-input-inline">
					<input id="userName" type="text" name="userName" lay-verify="" autocomplete="off" placeholder="请输入用户名" class="layui-input">
				</div>
			</div>
			<div class="layui-inline xp-input-container">
				<label class="layui-form-label">IP</label>
				<div class="layui-input-inline">
					<input id="ip" type="text" name="ip" lay-verify="" autocomplete="off" placeholder="请输入IP" class="layui-input">
				</div>
			</div>
			<div class="layui-inline xp-input-container">
				<button class="layui-btn" data-type="reload" id="findLogList">
					<i class="layui-icon">&#xe615;</i> 查询
				</button>
			</div>
		</div>
	</div>
	<table id="log_table"></table>
</div>
<script type="text/javascript">
	layui.use([ 'table', 'laydate', 'form' ], function() {
		var table = layui.table, form = layui.form, laydate = layui.laydate, $ = layui.$;

		laydate.render({
			elem : '#beginTime' //指定元素
		});
		laydate.render({
			elem : '#endTime' //指定元素
		});

		$("#type1").val('#(type1??)');
		form.render('select');

		//第一个实例
		table.render({
			id : 'log_table',
			elem : '#log_table',
			url : 'xpLog/pagingData',
			even: true,
			page : true,
			cols : [ [ {
				field : 'num',
				fixed : 'left',
				type : 'numbers'
			}, {
				field : 'NAME',
				title : '方法名称'
			}, {
				field : 'USERNAME',
				title : '用户名'
			}, {
				field : 'GXSJ',
				title : '调用时间',
				sort : true
			}, {
				field : 'PHONE',
				title : 'IP'
			}, {
				field : 'LX1',
				title : '类型',
				templet : function(d) {
					if (d.LX1 == '2') {
						return '登录管理';
					} else if (d.LX1 == '3') {
						return '用户管理';
					} else if (d.LX1 == '4') {
						return '角色管理';
					} else if (d.LX1 == '5') {
						return '部门管理';
					} else if (d.LX1 == '8') {
						return '报警系统通知';
					} else if (d.LX1 == '9') {
						return '考车维护';
					} else if (d.LX1 == '10') {
						return '视频参数维护';
					} else if (d.LX1 == '11') {
						return '场地监控维护';
					} else if (d.LX1 == '12') {
						return '坐标维护';
					} else {
						return d.LX1;
					}
				},
				unresize : true
			}, {
				field : 'SM',
				title : '日志说明'
			} ] ]
		});

		var active = {
			reload : function() {

				//执行重载
				table.reload('log_table', {
					page : {
						curr : 1
					},
					where : {
						beginTime : $('#beginTime').val(),
						endTime : $('#endTime').val(),
						type1 : $('#type1').val(),
						name : $('#name').val(),
						userName : $('#userName').val(),
						ip : $('#ip').val()
					}
				});
			}
		};

		$('#log_form .layui-btn').on('click', function() {
			var type = $(this).data('type');
			active[type] ? active[type].call(this) : '';
		});

	});
</script>
#end
